home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / misc / memtest8.000 / memtest8 / memtest86 / head.S < prev    next >
Encoding:
Text File  |  1996-04-25  |  1.7 KB  |  72 lines

  1. /*
  2.  *  linux/boot/head.S
  3.  *  Copyright (C) 1991, 1992  Linus Torvalds
  4.  */
  5.  
  6. /*
  7.  *  head.S contains the 32-bit startup code.
  8.  *
  9.  *  1-Jan-96 Modified by Chris Brady for use as a boot/loader for MemTest-86.
  10.  *  Setup the memory management for flat non-paged linear addressing.
  11.  */
  12.  
  13. .text
  14.  
  15. #include <linux/linkage.h>
  16. #include "mtest.h"
  17.  
  18. #ifndef SYMBOL_NAME
  19. #define SYMBOL_NAME(X) _/**/X
  20. #endif
  21.  
  22. .globl SYMBOL_NAME(memsz)
  23.  
  24. startup_32:
  25.     cld
  26.     cli
  27.     movl $(KERNEL_DS),%eax
  28.     mov %ax,%ds
  29.     mov %ax,%es
  30.     mov %ax,%fs
  31.     mov %ax,%gs
  32.     mov %ax,%ss
  33.     mov $(TESTADR),%esp
  34. /*
  35.  * start system 32-bit setup. We need to re-do some of the things done
  36.  * in 16-bit mode for the "real" operations.
  37.  */
  38.     xorl %eax,%eax
  39. a20:    incl %eax        # check that A20 really IS enabled
  40.     movl %eax,0x000000    # loop forever if it isn't
  41.     cmpl %eax,0x100000
  42.     je a20
  43. /*
  44.  * copy the memory size value 
  45.  */
  46.     movw (0x90000),%ax
  47.     movw %ax,SYMBOL_NAME(memsz)
  48.  
  49.         lgdt gdt_descr
  50.         ljmp $(KERNEL_CS),$flush
  51. flush:  movl $(KERNEL_DS),%eax  # reload all the segment registers
  52.         mov %ax,%ds             # after changing gdt.
  53.         mov %ax,%es
  54.         mov %ax,%fs
  55.         mov %ax,%gs
  56.     mov %ax,%ss
  57.  
  58.         call SYMBOL_NAME(do_test)
  59.  
  60. gdt_descr:
  61.         .word (16)*8-1
  62.         .long _gdt
  63.  
  64. .align 4
  65. _gdt:
  66.         .quad 0x0000000000000000        /* NULL descriptor */
  67.         .quad 0x0000000000000000        /* not used */
  68.         .quad 0x00c09a000000ffff        /* 0x10 main 256mb code at 0x000000 */
  69.         .quad 0x00c092000000ffff        /* 0x18 main 256mb data at 0x000000 */
  70.         .quad 0x00c09a100000ffff        /* 0x20 relo 256mb code at 0x100000 */
  71.         .quad 0x00c092100000ffff        /* 0x28 relo 256mb data at 0x100000 */
  72.